import Layout from '@/layout/index.vue'

/**
 * 异步路由
 * 需要根据用户角色动态加载的路由
 */
export const asyncRoutes = [
  // 前台接待模块
  {
    path: '/reception',
    component: Layout,
    redirect: '/reception/checkin',
    name: 'Reception',
    meta: {
      title: '前台接待',
      icon: 'Service',
      roles: ['admin', 'receptionist']
    },
    children: [
      {
        path: 'checkin',
        name: 'Checkin',
        component: () => import('@/views/reception/checkin/index.vue'),
        meta: {
          title: '入住办理',
          icon: 'UserFilled',
          roles: ['admin', 'receptionist']
        }
      },
      {
        path: 'checkout',
        name: 'Checkout',
        component: () => import('@/views/reception/checkout/index.vue'),
        meta: {
          title: '退房办理',
          icon: 'SwitchButton',
          roles: ['admin', 'receptionist']
        }
      },
      {
        path: 'reservation',
        name: 'Reservation',
        component: () => import('@/views/reception/reservation/index.vue'),
        meta: {
          title: '预订管理',
          icon: 'Calendar',
          roles: ['admin', 'receptionist']
        }
      },
      {
        path: 'guest',
        name: 'Guest',
        component: () => import('@/views/reception/guest/index.vue'),
        meta: {
          title: '客人管理',
          icon: 'Avatar',
          roles: ['admin', 'receptionist']
        }
      }
    ]
  },

  // 客房管理模块
  {
    path: '/room',
    component: Layout,
    redirect: '/room/list',
    name: 'Room',
    meta: {
      title: '客房管理',
      icon: 'OfficeBuilding',
      roles: ['admin', 'housekeeper', 'receptionist']
    },
    children: [
      {
        path: 'list',
        name: 'RoomList',
        component: () => import('@/views/room/list/index.vue'),
        meta: {
          title: '房间列表',
          icon: 'Grid',
          roles: ['admin', 'housekeeper', 'receptionist']
        }
      },
      {
        path: 'type',
        name: 'RoomType',
        component: () => import('@/views/room/type/index.vue'),
        meta: {
          title: '房型管理',
          icon: 'Collection',
          roles: ['admin', 'housekeeper']
        }
      },
      {
        path: 'status',
        name: 'RoomStatus',
        component: () => import('@/views/room/status/index.vue'),
        meta: {
          title: '房态管理',
          icon: 'Monitor',
          roles: ['admin', 'housekeeper', 'receptionist']
        }
      },
      {
        path: 'maintenance',
        name: 'RoomMaintenance',
        component: () => import('@/views/room/maintenance/index.vue'),
        meta: {
          title: '维护记录',
          icon: 'Tools',
          roles: ['admin', 'housekeeper']
        }
      }
    ]
  },

  // 财务账务模块
  {
    path: '/finance',
    component: Layout,
    redirect: '/finance/bill',
    name: 'Finance',
    meta: {
      title: '财务账务',
      icon: 'Money',
      roles: ['admin', 'finance']
    },
    children: [
      {
        path: 'bill',
        name: 'Bill',
        component: () => import('@/views/finance/bill/index.vue'),
        meta: {
          title: '账单管理',
          icon: 'Document',
          roles: ['admin', 'finance']
        }
      },
      {
        path: 'payment',
        name: 'Payment',
        component: () => import('@/views/finance/payment/index.vue'),
        meta: {
          title: '收费管理',
          icon: 'CreditCard',
          roles: ['admin', 'finance', 'receptionist']
        }
      },
      {
        path: 'report',
        name: 'FinanceReport',
        component: () => import('@/views/finance/report/index.vue'),
        meta: {
          title: '财务报表',
          icon: 'TrendCharts',
          roles: ['admin', 'finance']
        }
      },
      {
        path: 'statistics',
        name: 'FinanceStatistics',
        component: () => import('@/views/finance/statistics/index.vue'),
        meta: {
          title: '收入统计',
          icon: 'DataAnalysis',
          roles: ['admin', 'finance']
        }
      }
    ]
  },

  // 会员营销模块
  {
    path: '/member',
    component: Layout,
    redirect: '/member/list',
    name: 'Member',
    meta: {
      title: '会员营销',
      icon: 'Star',
      roles: ['admin', 'marketing', 'receptionist']
    },
    children: [
      {
        path: 'list',
        name: 'MemberList',
        component: () => import('@/views/member/list/index.vue'),
        meta: {
          title: '会员管理',
          icon: 'UserFilled',
          roles: ['admin', 'marketing', 'receptionist']
        }
      },
      {
        path: 'points',
        name: 'MemberPoints',
        component: () => import('@/views/member/points/index.vue'),
        meta: {
          title: '积分管理',
          icon: 'Medal',
          roles: ['admin', 'marketing', 'receptionist']
        }
      },
      {
        path: 'activity',
        name: 'MarketingActivity',
        component: () => import('@/views/member/activity/index.vue'),
        meta: {
          title: '营销活动',
          icon: 'Present',
          roles: ['admin', 'marketing']
        }
      },
      {
        path: 'analysis',
        name: 'MemberAnalysis',
        component: () => import('@/views/member/analysis/index.vue'),
        meta: {
          title: '会员分析',
          icon: 'PieChart',
          roles: ['admin', 'marketing']
        }
      }
    ]
  },

  // 系统管理模块
  {
    path: '/system',
    component: Layout,
    redirect: '/system/user',
    name: 'System',
    meta: {
      title: '系统管理',
      icon: 'Setting',
      roles: ['admin']
    },
    children: [
      {
        path: 'user',
        name: 'SystemUser',
        component: () => import('@/views/system/user/index.vue'),
        meta: {
          title: '用户管理',
          icon: 'User',
          roles: ['admin']
        }
      },
      {
        path: 'role',
        name: 'SystemRole',
        component: () => import('@/views/system/role/index.vue'),
        meta: {
          title: '角色管理',
          icon: 'Avatar',
          roles: ['admin']
        }
      },
      {
        path: 'menu',
        name: 'SystemMenu',
        component: () => import('@/views/system/menu/index.vue'),
        meta: {
          title: '菜单管理',
          icon: 'Menu',
          roles: ['admin']
        }
      },
      {
        path: 'log',
        name: 'SystemLog',
        component: () => import('@/views/system/log/index.vue'),
        meta: {
          title: '操作日志',
          icon: 'Document',
          roles: ['admin']
        }
      }
    ]
  },

  // 数据统计模块
  {
    path: '/statistics',
    component: Layout,
    redirect: '/statistics/overview',
    name: 'Statistics',
    meta: {
      title: '数据统计',
      icon: 'DataBoard',
      roles: ['admin', 'finance', 'marketing']
    },
    children: [
      {
        path: 'overview',
        name: 'StatisticsOverview',
        component: () => import('@/views/statistics/overview/index.vue'),
        meta: {
          title: '数据概览',
          icon: 'Monitor',
          roles: ['admin', 'finance', 'marketing']
        }
      },
      {
        path: 'occupancy',
        name: 'OccupancyRate',
        component: () => import('@/views/statistics/occupancy/index.vue'),
        meta: {
          title: '入住率统计',
          icon: 'TrendCharts',
          roles: ['admin', 'finance']
        }
      },
      {
        path: 'revenue',
        name: 'RevenueAnalysis',
        component: () => import('@/views/statistics/revenue/index.vue'),
        meta: {
          title: '收入分析',
          icon: 'Money',
          roles: ['admin', 'finance']
        }
      }
    ]
  }
]